package com.knife.blog.util;

public class BlogCommUtil {

    public static String showSimplePageHtml(int currentPage, int pages) {
        String s = "";
        if (currentPage > 1) {
            s += "<a href=# onclick='return gotoPage(" + (currentPage - 1)
                    + ")'>上一页</a> ";
        }

        int beginPage = currentPage - 3 < 1 ? 1 : currentPage - 3;
        s += currentPage + "/" + pages;
        if (currentPage < pages) {
            s += " <a href=# onclick='return gotoPage(" + (currentPage + 1)
                    + ")'>下一页</a> ";
        } else {
            s += " 下一页 ";
        }
        // s+=" 转到<input type=text size=2>页";
        return s;

    }

    public static String showStaticPageHtml(String fileName, int currentPage, int pages) {
        String s = "";
        if (currentPage > 1) {
            if (currentPage == 2) {
                s += "<a href=" + fileName + ".htm>上一页</a>  ";
            } else {
                s += "<a href=" + fileName + (currentPage - 1) + ".htm>上一页 </a> ";
            }
        }

        int beginPage = currentPage - 3 < 1 ? 1 : currentPage - 3;
        s += currentPage + "/" + pages;
        if (currentPage < pages) {
            s += " <a href=" + fileName + (currentPage + 1) + ".htm>下一页</a> ";
        } else {
            s += " 下一页 ";
        }
        // s+=" 转到<input type=text size=2>页";
        return s;

    }
    /*public static Map pageList2Map(IPageList pList,int size){
    List list = pList.getResult();
    Map[] pMap = new HashMap[list.size()/size+1];
    for(int i=0;i<pMap.length;i++){

    }
    return null;

    }*/
}
